import { Component, OnInit, Input } from '@angular/core';
import { FormControl } from '@angular/forms';

import { MaterialColorConfig } from '../../../configs/colors/material-color/material-color.config';
import { BaseDirective } from '../../../../core/models/base-directive.model';

@Component({
    selector: 'op-date-picker',
    templateUrl: './material-date-picker.component.html'
})
export class MaterialDatePickerComponent extends BaseDirective implements OnInit {
    @Input() isRequired: boolean;
    @Input() labelTitle: string;
    @Input() reactiveFormControl: FormControl;
    @Input() isTouchUI: boolean;
    @Input() color: string;
    @Input() minDate: Date;
    @Input() maxDate: Date;

    constructor() {
        super();
    }

    ngOnInit(): void {
        this.initializeProperties();
    }

    protected initializeProperties(): void {
        this.isRequired = this.isRequired || false;
        this.isTouchUI = this.isTouchUI || false;
        this.color = this.color || MaterialColorConfig.basic;
        this.minDate = this.minDate || null;
        this.maxDate = this.maxDate || null;
    }
}